<template>
  <view class="bottom-box">
    <view class="review-box">
      <scroll-view @scrolltolower="scrolltolower" refresher-background="rgba(0, 0, 0, 0)" class="scrollView" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" @refresherrefresh="onRefresh" @refresherrestore="onRestore" :style="{'height':  'calc('+ screenHeight  +'px' +' ' + '-' +' ' +'200rpx)'}" scroll-y="true">
        <view class="bid-box">
          <view class="line-box" v-for="(item,index ) in list" :key="index" @click.stop="seeOneDetailPrice(item)">
            <view class="pic">
              <image class="point-tag" :src="item.price_user_avatar"></image>
            </view>
            <view class="name-box">
              <view class="name">
                {{item.price_user_nickname}}
              </view>
              <view class="time">
                {{item.createtime}}
              </view>
            </view>
            <view class="jubao">
              已出价<text class="red">￥{{item.price}}</text>
            </view>
          </view>
        </view>
        <view class="nodata-st" v-if="form.page==form.last_page"> ------没有更多数据了------</view>
        <view class="nodata-st" v-if="list.length ==0"> ------暂无数据------</view>
        <view style="height:24rpx;"></view>
      </scroll-view>
    </view>

  </view>
</template>

<script>

import api from '@/api/index.js'
export default {
  components: {
  },
  data() {
    return {
      screenHeight: uni.getStorageSync('screenHeight') - uni.getStorageSync('safeAreaBottom'),
      safeareabottom: uni.getStorageSync('safeAreaBottom') + 48,
      statusBarHeight: uni.getStorageSync('statusBarHeight') + 10,
      triggered: true,
      list: [],
      form: {
        page: 1,
        page_size: 15,
        last_page: 0,
        id: '',
        position: '11'
      },

    };
  },
  onLoad(option) {
    this.form.id = option.id
    this.init()
    // uni.hideTabBar();
  },
  methods: {
    init() {
      //获取详情
      this.getdevAskgoodsPrice(11)
      //获取评论
      // this.initcomment()
      //获取报价

    },
    //出价列表 9=求货列表滚动,10=求货列表前十,11=求货列表分页
    getdevAskgoodsPrice(position) {
      api.base.getdevAskgoodsPrice(this.form).then(res => {
        if (res.code == 1) {
          this.list = this.form.page === 1 ? res.data.data : this.list.concat(res.data.data);
          this.form.last_page = res.data.last_page;
        } else {
          uni.showToast({
            title: res.msg,
            icon: 'none'
          });
        }
      });
    },
    onRefresh() {
      if (this._freshing) return;
      this._freshing = true;
      setTimeout(() => {
        this.init()
        this.triggered = false;
        this._freshing = false;
      }, 1000)
    },
    onRestore() {
      this.triggered = 'restore'; // 需要重置
      console.log("onRestore");
    },
    scrolltolower() {
      if (this.form.page < this.form.last_page) {
        this.form.page += 1;
        this.getdevAskgoodsPrice();
      }
    },
    goback() {
      uni.navigateBack(1)
    },

    seeOneDetailPrice(item) {
      uni.navigateTo({
        url: `/pages/componets/requestGoods/requestGoodsDetail/oneDetailPrice?disabled=` + true + '&id=' + item.id
      });
    }
  },
};
</script>

<style lang="less" scoped>
.titleBar {
  width: 100%;
  // height: 88rpx;
  color: #fff;
  font-size: 32rpx;
  line-height: 88rpx;
  font-weight: bold;
  display: flex;
  padding: 0 32rpx;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  // top: 0px;
  right: 0px;
  z-index: 99;

  .leftImg {
    width: 48rpx;
    height: 48rpx;
  }
  .rightImg {
    width: 48rpx;
    height: 48rpx;
  }

  .fenImg {
    width: 48rpx;
    height: 50rpx;
  }
}

.bgBox {
  position: absolute;
  width: 100vw;
  height: 1112rpx;
  overflow: hidden;
  top: 0;
  z-index: 1;
}

.bg-st {
  width: 100%;
}

.bottom-box {
  background: #ffffff;
  height: 100vh;

  .review-box {
    padding-top: 32rpx;
    padding-bottom: 32rpx;
    .sum-box {
      height: 46rpx;
      font-size: 30rpx;
      font-family: PingFang SC-Medium, PingFang SC;
      font-weight: 500;
      color: #333333;
      line-height: 46rpx;
      margin-left: 32rpx;
      margin-top: 24rpx;
      margin-right: 32rpx;
      display: flex;
      justify-content: space-between;
    }
    .bid-box {
      width: calc(100% - 64rpx);
      margin: 0rpx 32rpx 32rpx 32rpx;
      background: #f5f5f5;
      border-radius: 16rpx 16rpx 16rpx 16rpx;
      .line-box {
        height: 112rpx;
        width: calc(100% - 64rpx);
        margin-left: 32rpx;
        display: flex;
        position: relative;
        align-items: center;
        .pic {
          display: flex;
          justify-content: center;
          align-items: center;
          float: left;
          width: 64rpx;
          height: 64rpx;
          .point-tag {
            width: 64rpx;
            height: 64rpx;
            border-radius: 7694rpx 7694rpx 7694rpx 7694rpx;
          }
        }
        .name-box {
          height: 64rpx;
          padding-left: 16rpx;
          padding-right: 24rpx;

          .name {
            height: 32rpx;
            line-height: 32rpx;
            font-size: 24rpx;
            font-family: PingFang SC-Bold, PingFang SC;
            font-weight: bold;
            color: #333333;
          }
          .time {
            font-size: 20rpx;
            font-family: PingFang SC-Medium, PingFang SC;
            font-weight: 500;
            color: rgba(0, 0, 0, 0.24);
          }
        }
        .jubao {
          display: flex;
          justify-content: center;
          align-items: center;
          height: 72rpx;
          position: absolute;
          right: 0rpx;
          font-size: 24rpx;
          font-family: PingFang SC-Medium, PingFang SC;
          font-weight: 500;
          color: #333333;
          .red {
            padding-left: 8rpx;
            font-weight: bold;
            color: #ff2544 !important;
          }
        }
      }
    }
    .botton-st {
      height: 88rpx;
      background: #6d0cf7;
      border-radius: 24rpx 24rpx 24rpx 24rpx;
      opacity: 0.5;
      font-size: 28rpx;
      font-family: PingFang SC-Medium, PingFang SC;
      font-weight: 500;
      color: #ffffff;
      line-height: 88rpx;
      text-align: center;
      margin: 32rpx 64rpx 0rpx 64rpx;
      width: calc(100% - 128rpx);
    }
  }
}
.footPublish {
  display: flex;
  align-items: center;
  height: 104rpx;
  .myInput {
    display: inline-block;
    background: #f7f7f7;
    border-radius: 40rpx;
    opacity: 1;
    border: 1rpx solid rgba(0, 0, 0, 0.12);
    flex: 1;
    padding: 6rpx 18rpx;
    ::v-deep.u-input__textarea {
      min-height: 0 !important;
    }
  }

  .right {
    display: inline-block;
    background: #333333;
    margin-left: 24rpx;
    border-radius: 60rpx;
    font-size: 28rpx;
    font-weight: bold;
    color: #ffffff;
    line-height: 42rpx;
    padding: 10rpx 26rpx;
  }
  .right-box {
    display: flex;
    height: 42rpx;
    line-height: 42rpx;
    padding-left: 6rpx;
    .img {
      width: 40rpx;
      padding-left: 16rpx;
      margin-right: 10rpx;
      .img-tag {
        width: 40rpx;
        height: 40rpx;
      }
    }
    .value {
      padding-left: 10rpx;

      font-size: 28rpx;
      font-family: HarmonyOS Sans-Regular, HarmonyOS Sans;
      font-weight: 400;
      color: #333333;
      // padding-right: 30rpx;
    }
  }
}
.x-footBar {
  // height: 104rpx !important;
  padding: 0rpx 26rpx 26rpx 32rpx !important;
  // box-sizing: border-box;
}
</style>